<?php
define('START', true);

session_start();

$abs_root = '../';

include($abs_root . 'src/DBHandle.php');
include($abs_root . 'src/AgentHandle.php');

// unset all values in $_SESSION array //
	unset($_SESSION['username']);	
	unset($_SESSION['logged']);
	unset($_SESSION['user_type']);
	unset($_SESSION['agentPermissions']);
	unset($_SESSION['agentUsername']);
	unset($_SESSION['agentId']);

	$db = new DBHandle();
	AgentHandle::agentLogOut($_SESSION['timeId']);
	
	unset($_SESSION['timeId']);
	
	
	$_SESSION = array();
	
	session_destroy();
	
	$db->closeDBConnection();

header("refresh: 0; url= ../index.php");
?>
